import type { RouteRecordRaw } from 'vue-router'
import { AppCodeType } from '@apps/_share/enums'
import { MAIN_APP_SLOT_ROUTE_PATH } from '@apps/_share/settings'
import { RouteName, RoutePath } from '../enums/route'

const base: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: RoutePath.home,
    component: () => import('@main/layouts/default.vue'),
    children: [
      {
        path: RoutePath.home,
        name: RouteName.home,
        component: () => import('@main/views/home/index.vue'),
        meta: {
          title: '首页',
        },
      },
    ],
  },
  ...Object.values(AppCodeType).map(appCode => ({
    path: `${MAIN_APP_SLOT_ROUTE_PATH}/:projectCode/${appCode}/:path*`,
    component: () => import('@apps/_share/layouts/default.vue'),
  })),
]

export default base
